package org.hong.monkey.rdd

import org.hong.monkey.{TaskContext, Partition, MonkeyContext}

import scala.reflect.ClassTag

/**
 * An RDD that has no partitions and no elements.
 */
private[monkey] class EmptyRDD[T: ClassTag](sc: MonkeyContext) extends RDD[T](sc, Nil) {

  override def getPartitions: Array[Partition] = Array.empty

  override def compute(split: Partition, context: TaskContext): Iterator[T] = {
    throw new UnsupportedOperationException("empty RDD")
  }
}
